package com.study.ipUtil;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @author hgy
 * @date 2019/11/28 9:52
 */
@RestController
public class IpController {

    @GetMapping("/getIp")
    public String getIp(HttpServletRequest request){
        return IpUtil.getIp(request);
    }

    @GetMapping("/getAddress")
    public Map getAddress(HttpServletRequest request){
        String ip = IpUtil.getIp(request);
        return IpUtil.getAddressByIp(ip);
    }
}
